﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace Hands.Queue
{
    public sealed class AtomicReference<T> : Atomic<T> where T : class
    {
        public AtomicReference(T value)
            : base(value)
        {

        }

        public override bool compareAndSet(T current, T next)
        {
            return Interlocked.CompareExchange<T>(ref value, next, current) == current;
        }
    }
}
